﻿using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mock1G3.BussinessLogic;
using Mock1G3.BaseEntities;
using System.Data;
using Mock1G3.DataAccess;

namespace Test_Mock1G3.CheckBalance
{
    /// <summary>
    /// Summary description for CheckBalance
    /// </summary>
    [TestClass]
    public class CheckBalance
    {
        public CheckBalance()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void GetBalanceTest1()
        {
            GetBalanceLogic account = new GetBalanceLogic();
            Card card = new Card();
            card.CardNo = "0123456789123457";
            string c = "0123456789123457";
            DataTable actual = account.GetBalance(card);
            DataTable expected = DataAccess.ExeStoredWithParamToDataTable("usp_CheckBalance", "@CardNo", c);
            Assert.IsTrue(TableComparer.CompareDataTables(expected, actual));
        }
        [TestMethod]
        public void GetBalanceTest2()
        {
            GetBalanceLogic account = new GetBalanceLogic();
            Card card = new Card();
            card.CardNo = "";
            string c = "";
            DataTable actual = account.GetBalance(card);
            DataTable expected = DataAccess.ExeStoredWithParamToDataTable("usp_CheckBalance", "@CardNo", c);
            Assert.IsTrue(TableComparer.CompareDataTables(expected, actual));
        }
        [TestMethod]
        public void GetBalanceTest3()
        {
            GetBalanceLogic account = new GetBalanceLogic();
            Card card = new Card();
            card.CardNo = "0123456789123470";
            string c = "0123456789123470";
            DataTable actual = account.GetBalance(card);
            DataTable expected = DataAccess.ExeStoredWithParamToDataTable("usp_CheckBalance", "@CardNo", c);
            Assert.IsTrue(TableComparer.CompareDataTables(expected, actual));
        }
        [TestMethod()]
        public void InsertLogTest1()
        {
            Card card = new Card();
            card.CardNo = "";
            InsertLogUC3Logic log = new InsertLogUC3Logic();
            ATM atm = new ATM();
            atm.ATMID = 0;
            bool actual = log.Insert(atm, card);
            bool expected = true;
            Assert.AreEqual(expected, actual);
        }
        [TestMethod()]
        public void InsertLogTest2()
        {
            Card card = new Card();
            card.CardNo = "0123456789123470";
            InsertLogUC3Logic log = new InsertLogUC3Logic();
            ATM atm = new ATM();
            atm.ATMID = 10;
            bool actual = log.Insert(atm, card);
            bool expected = true;
            Assert.AreEqual(expected, actual);
        }
        [TestMethod()]
        public void InsertLogTest3()
        {
            Card card = new Card();
            card.CardNo = "0123456789123457";
            InsertLogUC3Logic log = new InsertLogUC3Logic();
            ATM atm = new ATM();
            atm.ATMID = 1;
            bool actual = log.Insert(atm, card);
            bool expected = true;
            Assert.AreEqual(expected, actual);
        }
    }
}
